<?php 
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header', 'admin');
?>
<div class="pad-10">
<form method="post" action="?m=courses&c=admin_courses&a=courseadd" name="myform" id="myform">
<table class="table_form" width="100%" cellspacing="0">
<tbody>
	<tr>
		<th width="80"><strong><?php echo L('courses_name')?></strong></th>
		<td><input name="courses[csname]" id="csname" class="input-text" type="text" size="50" ></td>
	</tr>
	<tr>
		<th width="80"><strong><?php echo L('is_used')?></strong></th>
		<td><?php echo form::radio(array('1'=>L('used'), '0'=>L('unused')), 1, 'name="courses[csused]"');?></td>
	</tr>
	</tbody>
</table>
<input type="submit" name="dosubmit" id="dosubmit" value=" <?php echo L('ok')?> " class="button">&nbsp;
<input type="reset" class="button" value=" <?php echo L('clear')?> ">
</form>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
	$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'220',height:'70'}, function(){this.close();$(obj).focus();})}});
	$('#csname').formValidator({onshow:"<?php echo L('courses_name_input')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('courses_name_empty')?>"}).ajaxValidator({type:"get",url:"",data:"m=courses&c=admin_courses&a=check_course_name",datatype:"html",cached:false,async:'true',success : function(data) {
        if( data == "1" )
		{
            return true;
		}
        else
		{
            return false;
		}
	},
	error: function(){alert("<?php echo L('server_no_data')?>");},
	onerror : "<?php echo L('courses_name_exist')?>",
	onwait : "<?php echo L('checking')?>"
	});
});
</script>